package cn.wolfcode.web.controller;

import cn.wolfcode.common.web.Result;
import cn.wolfcode.domain.OperateIntergralVo;
import cn.wolfcode.service.IUsableIntegralService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/intergral")
public class IntegralController {
    @Autowired
    private IUsableIntegralService usableIntegralService;
    /**
     * 减少积分
     *
     * @param op 人事处
     * @return {@link Result}<{@link String}>
     */
    @RequestMapping("/minusPoints")
    public Result<String> reducePoints(@RequestBody OperateIntergralVo op){
        usableIntegralService.reducePoints(op);
        return Result.success("");
    }
    /**
     * 添加积分
     *
     * @param op 人事处
     * @return {@link Result}<{@link String}>
     */
    @RequestMapping("/refundIntergal")
    Result<String> refundIntergal(@RequestBody OperateIntergralVo op){
        usableIntegralService.refundIntergal(op);
        return Result.success("");
    }
}
